% GAUTIER LE BIHAN - 2020
% Replication files for "Shocks vs Menu Costs: Patterns of Price Rigidity in an Estimated Multi-Sector 
% Menu-Cost Model" Review of Economics and Statistics
% Compute additional simulated moments for Appendix figure F

clear;
tic

addpath('..\..\Utilities')  

NSectors = 1;
sm = 0.0;

p0=[0]';
mu_c=[0.0003:0.00025:0.006]'
sig_eps=[0.045:0.0015:0.085]'
rho_a=[0.05:0.0025:0.12]';


s=size(mu_c,1)+size(sig_eps,1)+size(rho_a,1)
param0=[0.049 ;   0.024   ; 0.0381 ;   0.653];
param0=[0; 0.00394717842275024; exp(-2.70550299586474); tanh(0.0712017218151696)];
param0=[0; 0.004; 0.0673; 0.0710];

param=repmat(param0,1,s)';

%param(1:size(p0),1)=p0;
param(1:size(mu_c),2)=mu_c;
param(size(mu_c)+1:size(mu_c)+size(sig_eps),3)=sig_eps;
param(size(mu_c)+size(sig_eps)+1:size(mu_c)+size(sig_eps)+size(rho_a,1),4)=rho_a;


s=size(param)
mu_vec=0.00125;

size_mu=1;
for ii=1:size_mu;
    
mu_loop=mu_vec*ii;
     fprintf("ii");
     disp(ii);
%for jj=1+s*(ii-1):ii*s;
for jj=1:s;
     fprintf("jj");
     disp(jj);
     %"i" i);
    p0=param(jj,1);
    mu_c=param(jj,2);
    sig_eps_a=param(jj,3);
    %p_a=param(jj,4); 
    rho_a=param(jj,4);
    weight_j=0.57;    
 
   [f2, avfracup2,    med2,   interq2, kur2]=geNCalvoPlus_SMM(mu_loop, p0, mu_c, sig_eps_a, rho_a, weight_j);
 
  stat_temp(jj,:)=[ii param(jj,:) f2 avfracup2      med2    interq2 kur2];
stat_temp

end

stat_outsample_testh(1+s*(ii-1):ii*s,:)=stat_temp
save stat_outsample_testh stat_outsample_testh;


end